Xbasic

LASTWORD Function

Syntax

Word as C = lastword(C string [,C separator ])

Arguments

lastword

The last word of the string. Character

string

A string with multiple words or entries separated by a delimiter.

separator

Optional. Default = " ". The delimiter that separates the words or entries. Character

Description

returns the last "word" in a string

Discussion

The LASTWORD() function returns the last word or entry in a string.

Example

dim s1 as C
dim s2 as C
s1 = "one two three four"
s2 = "one" + crlf() + "two" + crlf()  + "three" + crlf() + "four"
? lastword(s1, " ")
= "four"
? lastword(s2, crlf() )
= "four"

See Also